﻿using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace YYTmEditer.MtObject
{
	public class EffectUpgrade{
		public string statusId;
		public int count;
	}
	public class CardUpgrader
	{
		public string cardUpgradeDataId;
		public int attackDamage = 0;
		public int additionalHP = 0;
		public int costReduction = 0;
		public int xCostReduction = 0;
		public int additionalHeal = 0;
		public int additionalSize = 0;
		public bool useUpgradeHighlightTextTags;
		public List<EffectUpgrade> statusEffectUpgrades = new List<EffectUpgrade>();

		public override string ToString()
		{
			return NameMap.ShopName.Contains(cardUpgradeDataId) ? NameMap.ShopName.GetValue(cardUpgradeDataId) : "升级+1";
		}

	}

	public class Upgradeer
	{
		public int additionalDamage=0;
		public int additionalMaxHP = 0;
		public int additionalCost = 0;
		public int additionalHeal = 0;
		public int additionalXCost = 0;
		public int additionalSize = 0;
		public List<CardUpgrader> cardTraitReplacements = new List<CardUpgrader>();
		public List<CardUpgrader> cardUpgrades=new List<CardUpgrader>();
	}

    public class Card : ICloneable
	{
		public string cardDataID;
		public Upgradeer cardModifiers = new Upgradeer();

		public override string ToString()
		{

			return NameMap.CardName.Contains(cardDataID) ? NameMap.CardName.GetValue(cardDataID) : "双击编辑单位名称";
		}

		public string GetInfo() {
			if (this.cardModifiers.cardUpgrades.Count > 0) {
				StringBuilder sb = new StringBuilder();
				this.cardModifiers.cardUpgrades.ForEach((up) => {
					sb.Append(up.ToString());
					sb.Append("\r\n");
				});
				return sb.ToString();
			}
			return "无升级";
		}

		public object Clone()
		{
			JObject jo = JObject.FromObject(this);
			return jo.DeepClone().ToObject<Card>();
		}
	}
}
